<?php

require_once("params.php");

class ConnexionBD{
	
	private static $instance = null;
	private static $connexionBD;
	
	private function __construct(){ 
		$pdo = new PDO('mysql:host='.BD_HOTE.';dbname='.BD_NOM, BD_LOGIN, BD_MDP);
		$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
		$this->connexionBD = $pdo;
	}
	
	public static function getInstance(){
		if (is_null(self::$instance))
			self::$instance = new ConnexionBD();
		return self::$instance->getConnexionBD();
	}
	
	private function getConnexionBD(){
		return $this->connexionBD;
	}
	
}
?>